# -*- coding: utf-8 -*-

# -------------------------------
# Author    : linlingwei
# Email     : 951035650@qq.com
# File Name : driverCmds.py
# Date      : 2017/12/12
# IDE       : PyCharm
# Version   : 1.1.1
# -------------------------------
# 1.2.1 add 4/8 setting.

__author__ = "lin lingwei"
__version__ = "1.2.1"

import traceback
import maya.cmds as mc

import scripts.commonCmds as cCore
reload(cCore)
# from basis.baseClass import baseClass as base


class SoliDrive_class(object):
    """
    Solid Drive

    """
    driAttr = ['UP', 'DOWN', 'LEFT', 'RIGHT', 'UP_LEFT', 'UP_RIGHT', 'DOWN_LEFT', 'DOWN_RIGHT']
    testDict = {'UP': [0, 1, 0], 'DOWN': [0, -1, 0], 'LEFT': [0, 0, -1], 'RIGHT': [0, 0, 1],
                'UP_LEFT': [0, 0.707, -0.707], 'UP_RIGHT': [0, 0.707, 0.707],
                'DOWN_LEFT': [0, -0.707, -0.707], 'DOWN_RIGHT': [0, -0.707, 0.707]}
    
    def __init__(self, prefix='LC'):
        self.prefix = prefix
        self.parent_trans = ""
        self.yz_yAxis_angle = ""
        self.yz_zAxis_angle = ""
        self.driLoc_xAxis_angle = ""
    def settings_transform(self,mo="4/8"):
        """
        create transform and setting attribute

        :return: driver settings transform
        """
        self.parent_trans = mc.createNode('transform', name=self.prefix + '_solidDrive_grp')

        sets = mc.createNode('transform', n=self.prefix + '_solidDrive_settings', p=self.parent_trans)
        cCore.lockHideAttr(sets)
        # base().lockHideAttr(sets)
        mc.addAttr(sets, ln="author", at="enum", en="{}:".format(__author__), k=True, )
        mc.addAttr(sets, ln="version", at="enum", en="{}:".format(__version__), k=True, )
        mc.addAttr(sets, ln="model", at="enum", en="{}:".format(mo), k=True, )
        
        attrname = 'min_angle'
        mc.addAttr(sets, at='float', shortName=attrname, longName=attrname, defaultValue=0.0, minValue=0, maxValue=178)
        mc.setAttr('%s.%s' % (sets, attrname), e=True, keyable=True)
        
        attrname = 'max_angle'
        mc.addAttr(sets, at='float', shortName=attrname, longName=attrname, defaultValue=178.0, minValue=0,
                   maxValue=178)
        mc.setAttr('%s.%s' % (sets, attrname), e=True, keyable=True)
        
        attrname = 'min_driver_value'
        mc.addAttr(sets, at='float', shortName=attrname, longName=attrname, defaultValue=0.0)
        mc.setAttr('%s.%s' % (sets, attrname), e=True, keyable=True)
        
        attrname = 'max_driver_value'
        mc.addAttr(sets, at='float', shortName=attrname, longName=attrname, defaultValue=1.0)
        mc.setAttr('%s.%s' % (sets, attrname), e=True, keyable=True)
        
        attrname = 'driver_count'
        mc.addAttr(sets, at='long', shortName=attrname, longName=attrname, defaultValue=8)
        mc.setAttr('%s.%s' % (sets, attrname), e=True, keyable=True, lock=True)
        
        for attr in SoliDrive_class.driAttr:
            attrname = attr
            mc.addAttr(sets, at='float', shortName=attrname, longName=attrname, defaultValue=0.0)
            mc.setAttr('%s.%s' % (sets, attrname), e=True, keyable=True)
        
        return sets
    
    def coordinates_sys(self):
        """
        create coordinates sys locator
        :return: True
        """
        sys_grp = mc.createNode('transform', n=self.prefix + '_sys_grp', p=self.parent_trans)
        # mc.hide(sys_grp)
        xLoc = mc.spaceLocator(n='%s_X_Axis' % self.prefix)[0]
        yLoc = mc.spaceLocator(n='%s_Y_Axis' % self.prefix)[0]
        zLoc = mc.spaceLocator(n='%s_Z_Axis' % self.prefix)[0]
        mc.setAttr('%s.tx' % xLoc, 1)
        mc.setAttr('%s.ty' % yLoc, 1)
        mc.setAttr('%s.tz' % zLoc, 1)
        cCore.changColor(xLoc,13)
        cCore.changColor(yLoc,14)
        cCore.changColor(zLoc,6)
        
        [mc.setAttr(_+".localScale",0.5,0.5,0.5)for _  in [xLoc,yLoc,zLoc]]
        
        yzLoc = mc.spaceLocator(n='%s_YZ_position' % self.prefix)[0]
        mc.parent(xLoc, yLoc, zLoc, yzLoc, sys_grp)
        mc.hide(yzLoc)
        
        driLoc = mc.spaceLocator(n='%s_Dri_position' % self.prefix)[0]
        mc.parent(driLoc, self.parent_trans)
        mc.setAttr('%s.tx' % driLoc, 2)
        cCore.changColor(driLoc,17)
        
        
        mc.connectAttr('%s.ty' % driLoc, '%s.ty' % yzLoc)
        mc.connectAttr('%s.tz' % driLoc, '%s.tz' % yzLoc)
        
        self.yz_yAxis_angle = mc.createNode('angleBetween', n='%s_yz_yAxis_angle' % self.prefix)
        mc.connectAttr('%s.t' % yLoc, '%s.vector1' % self.yz_yAxis_angle)
        mc.connectAttr('%s.t' % yzLoc, '%s.vector2' % self.yz_yAxis_angle)
        
        self.yz_zAxis_angle = mc.createNode('angleBetween', n='%s_yz_zAxis_angle' % self.prefix)
        mc.connectAttr('%s.t' % zLoc, '%s.vector1' % self.yz_zAxis_angle)
        mc.connectAttr('%s.t' % yzLoc, '%s.vector2' % self.yz_zAxis_angle)
        
        self.driLoc_xAxis_angle = mc.createNode('angleBetween', n='%s_driLOC_xAxis_angle' % self.prefix)
        mc.connectAttr('%s.t' % xLoc, '%s.vector1' % self.driLoc_xAxis_angle)
        mc.connectAttr('%s.t' % driLoc, '%s.vector2' % self.driLoc_xAxis_angle)
        
        return True
    
    def uniaxial_driver(self, axis, axisValue, setTrans, mainAngle, sideAngle, yz_yAxis_angle=None,
                        yz_zAxis_angle=None):
        setRange = mc.createNode('setRange', n='%s_%s_setRange' % (self.prefix, axis))
        # print setRange
        mc.connectAttr('%s.angle' % mainAngle, '%s.valueX' % setRange)
        
        mc.connectAttr('%s.max_angle' % setTrans, '%s.oldMaxX' % setRange)
        mc.connectAttr('%s.min_angle' % setTrans, '%s.oldMinX' % setRange)
        
        mc.connectAttr('%s.max_driver_value' % setTrans, '%s.maxX' % setRange)
        mc.connectAttr('%s.min_driver_value' % setTrans, '%s.minX' % setRange)
        
        if yz_yAxis_angle is not None:
            mc.connectAttr('%s.angle' % yz_yAxis_angle[0], '%s.valueY' % setRange)
            
            mc.setAttr('%s.oldMaxY' % setRange, yz_yAxis_angle[1])
            mc.setAttr('%s.oldMinY' % setRange, yz_yAxis_angle[2])
            
            mc.setAttr('%s.maxY' % setRange, yz_yAxis_angle[3])
            mc.setAttr('%s.minY' % setRange, yz_yAxis_angle[4])
        else:
            pass
        if yz_zAxis_angle is not None:
            mc.connectAttr('%s.angle' % yz_zAxis_angle[0], '%s.valueZ' % setRange)
            
            mc.setAttr('%s.oldMaxZ' % setRange, yz_zAxis_angle[1])
            mc.setAttr('%s.oldMinZ' % setRange, yz_zAxis_angle[2])
            
            mc.setAttr('%s.maxZ' % setRange, yz_zAxis_angle[3])
            mc.setAttr('%s.minZ' % setRange, yz_zAxis_angle[4])
        else:
            pass
        
        Y_blendColor = mc.createNode('blendColors', n='%s_%s_Y_blendColor' % (self.prefix, axis))
        
        mc.connectAttr('%s.outValueX' % setRange, '%s.blender' % Y_blendColor)
        mc.connectAttr('%s.outValueY' % setRange, '%s.color1R' % Y_blendColor)
        
        mc.setAttr('%s.color2' % Y_blendColor, 0, 0, 0, type='double3')
        
        Z_blendColor = mc.createNode('blendColors', n='%s_%s_Z_blendColor' % (self.prefix, axis))
        mc.connectAttr('%s.outValueX' % setRange, '%s.blender' % Z_blendColor)
        mc.connectAttr('%s.outValueZ' % setRange, '%s.color1R' % Z_blendColor)
        
        mc.setAttr('%s.color2' % Z_blendColor, 0, 0, 0, type='double3')
        
        sideCondition = mc.createNode('condition', n='%s_%s_outCondition' % (self.prefix, axis))
        mc.connectAttr('%s.angle' % sideAngle, '%s.firstTerm' % sideCondition)
        mc.connectAttr('%s.outputR' % Y_blendColor, '%s.colorIfTrueR' % sideCondition)
        mc.connectAttr('%s.outputR' % Z_blendColor, '%s.colorIfFalseR' % sideCondition)
        mc.setAttr('%s.secondTerm' % sideCondition, axisValue)
        mc.setAttr('%s.operation' % sideCondition, 4)
        
        return sideCondition
    
    def rangeCondition(self, axis, yz_yAxis_angle, yz_zAxis_angle, Max, Min):
        maxCondition = mc.createNode('condition', n='%s_%s_maxCondition' % (self.prefix, axis))
        mc.connectAttr('%s.angle' % yz_yAxis_angle, '%s.firstTerm' % maxCondition)
        mc.setAttr('%s.secondTerm' % maxCondition, Max)
        mc.setAttr('%s.operation' % maxCondition, 4)
        mc.setAttr('%s.colorIfTrueR' % maxCondition, 1)
        mc.setAttr('%s.colorIfFalseR' % maxCondition, 0)
        
        mincondition = mc.createNode('condition', n='%s_%s_minCondition' % (self.prefix, axis))
        
        mc.connectAttr('%s.angle' % yz_zAxis_angle, '%s.firstTerm' % mincondition)
        mc.connectAttr('%s.outColorR' % maxCondition, '%s.colorIfTrueR' % mincondition)
        
        mc.setAttr('%s.secondTerm' % mincondition, Min)
        mc.setAttr('%s.operation' % mincondition, 2)
        mc.setAttr('%s.colorIfFalseR' % mincondition, 0)
        
        return mincondition
    
    def outCondition(self, axis, rangeCondition, sideCondition):
        outCon = mc.createNode('condition', n='%s_%s_outCondition' % (self.prefix, axis))
        mc.connectAttr('%s.outColorR' % rangeCondition, '%s.firstTerm' % outCon)
        mc.connectAttr('%s.outColorR' % sideCondition, '%s.colorIfTrueR' % outCon)
        
        mc.setAttr('%s.secondTerm' % outCon, 0)
        mc.setAttr('%s.operation' % outCon, 2)
        mc.setAttr('%s.colorIfFalseR' % outCon, 0)
        
        return outCon
    
    def standByDo8_8(self):
        setting = self.settings_transform("8/8")
        self.coordinates_sys()
        
        axis = 'UP'
        sideCon = self.uniaxial_driver(axis, 90, setting, self.driLoc_xAxis_angle,
                                       self.yz_zAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 45, 0, 0, 1],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 135, 90, 0, 1])
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,
                                       self.yz_zAxis_angle,
                                       45,
                                       45)
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        axis = 'DOWN'
        sideCon = self.uniaxial_driver(axis,
                                       90, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_zAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 180, 135, 1, 0],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 135, 90, 0, 1])
        
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle,
                                       self.yz_yAxis_angle, 135, 135)
        
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        axis = 'LEFT'
        
        sideCon = self.uniaxial_driver(axis,
                                       90, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 90, 45, 1, 0],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 180, 135, 1, 0])
        
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,
                                       self.yz_zAxis_angle, 135, 135)
        
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        axis = 'RIGHT'
        
        sideCon = self.uniaxial_driver(axis,
                                       90, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 90, 45, 1, 0],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 45, 0, 0, 1])
        
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle,
                                       self.yz_yAxis_angle, 45, 45)
        
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        axis = 'UP_LEFT'
        
        sideCon = self.uniaxial_driver(axis,
                                       45, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 45, 0, 1, 0],
                                       yz_zAxis_angle=[self.yz_yAxis_angle, 90, 45, 0, 1])
        
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,
                                       self.yz_zAxis_angle, 90, 90)
        
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        axis = 'UP_RIGHT'
        
        sideCon = self.uniaxial_driver(axis,
                                       45, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 45, 0, 1, 0],
                                       yz_zAxis_angle=[self.yz_yAxis_angle, 90, 45, 0, 1])
        
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle,
                                       self.yz_zAxis_angle, 90, 0)
        
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        axis = 'DOWN_LEFT'
        
        sideCon = self.uniaxial_driver(axis,
                                       135, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 135, 90, 1, 0],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 135, 90, 1, 0])
        
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,
                                       self.yz_zAxis_angle, 180, 90)
        
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        axis = 'DOWN_RIGHT'
        
        sideCon = self.uniaxial_driver(axis,
                                       135, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 135, 90, 1, 0],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 90, 45, 0, 1])
        
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle,
                                       self.yz_zAxis_angle, 90, 0)
        
        outCon = self.outCondition(axis, rangeCon, sideCon)
        
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
        
        return True

    def standByDo4_8(self):
        setting = self.settings_transform("4/8")
        self.coordinates_sys()
    
        axis = 'UP'
        sideCon = self.uniaxial_driver(axis, 90, setting, self.driLoc_xAxis_angle,
                                       self.yz_zAxis_angle,
                                       #                yAxial              omax,omin,max,min
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 90,  0,   0,  1],
                                       #                zAxial              omax,omin,max,min
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 180, 90, 0, 1])
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,#yAxial angle max
                                       self.yz_zAxis_angle,#zAxial angle min
                                       90,# yAxial range max value
                                       0 # zAxial range min value
                                       )
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        axis = 'DOWN'
        sideCon = self.uniaxial_driver(axis,
                                       90, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_zAxis_angle,
                                       #                yAxial              omax,omin,max,min
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 180, 90, 1, 0],
                                       #                zAxial              omax,omin,max,min
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 180, 90, 0, 1])
    
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle,#Axial angle max
                                       self.yz_yAxis_angle,#Axial angle min
                                       180,# Axial range max value
                                       90 # Axial range min value
                                       )
    
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        axis = 'LEFT'
    
        sideCon = self.uniaxial_driver(axis,
                                       90, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       #                yAxial              omax,omin,max,min
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 90, 0, 1, 0],
                                       #                zAxial              omax,omin,max,min
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 180, 90, 1, 0])
    
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,#yAxial angle max
                                       self.yz_zAxis_angle,#zAxial angle min
                                       180,# yAxial range max value
                                       90 # zAxial range min value
                                       )
    
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        axis = 'RIGHT'
    
        sideCon = self.uniaxial_driver(axis,
                                       90, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       #                yAxial              omax,omin,max,min
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 90, 0, 1, 0],
                                       #                zAxial              omax,omin,max,min
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 90, 0, 0, 1])
    
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle, #yAxial angle max
                                       self.yz_yAxis_angle, #zAxial angle min
                                       90, # yAxial range max value
                                       0  # zAxial range min value
                                       )
    
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        axis = 'UP_LEFT'
    
        sideCon = self.uniaxial_driver(axis,
                                       45, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 45, 0, 1, 0],
                                       yz_zAxis_angle=[self.yz_yAxis_angle, 90, 45, 0, 1])
    
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,
                                       self.yz_zAxis_angle, 90, 90)
    
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        axis = 'UP_RIGHT'
    
        sideCon = self.uniaxial_driver(axis,
                                       45, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 45, 0, 1, 0],
                                       yz_zAxis_angle=[self.yz_yAxis_angle, 90, 45, 0, 1])
    
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle,
                                       self.yz_zAxis_angle, 90, 0)
    
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        axis = 'DOWN_LEFT'
    
        sideCon = self.uniaxial_driver(axis,
                                       135, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 135, 90, 1, 0],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 135, 90, 1, 0])
    
        rangeCon = self.rangeCondition(axis,
                                       self.yz_yAxis_angle,
                                       self.yz_zAxis_angle,
                                       180,
                                       90)
    
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        axis = 'DOWN_RIGHT'
    
        sideCon = self.uniaxial_driver(axis,
                                       135, setting,
                                       self.driLoc_xAxis_angle,
                                       self.yz_yAxis_angle,
                                       yz_yAxis_angle=[self.yz_yAxis_angle, 135, 90, 1, 0],
                                       yz_zAxis_angle=[self.yz_zAxis_angle, 90, 45, 0, 1])
    
        rangeCon = self.rangeCondition(axis,
                                       self.yz_zAxis_angle,
                                       self.yz_zAxis_angle, 90, 0)
    
        outCon = self.outCondition(axis, rangeCon, sideCon)
    
        mc.connectAttr('%s.outColorR' % outCon, '%s.%s' % (setting, axis))
    
        return True
    def do(self,m=0):
        """
        create driver

        """
        # self.standByDo()
        # base().printout('Create Successful')
        try:
            if m == 0:
                self.standByDo4_8()
            elif m == 1:
                self.standByDo8_8()
        except:
            traceback.print_exc()
        # except RuntimeError,errorInfo:
        #     # base().error(errorInfo)
        #     pass
        # except ValueError,errorInfo:
        #     pass
        #     # base().error(errorInfo)
        else:
            # base().printout('Create Successful')
            return True
        finally:
            return False
    
    def createTestExample(self,m=0):
        self.do(m)
        jnt = mc.joint(n='test_dri_jnt', p=[0, 0, 0], rad=0.1)
        jntEnd = mc.joint(n='test_dri_end_jnt', p=[1, 0, 0], rad=0.1)
        mc.joint(jnt, e=True, zso=True, oj='xyz', sao='yup')
        mc.parentConstraint(jntEnd, '%s_Dri_position' % self.prefix, mo=True)
        attrDict = SoliDrive_class.testDict
        
        for attr in attrDict.keys():
            sphere = mc.sphere(n=attr + '_sphere', r=0.1)[0]
            translate = attrDict[attr]
            mc.setAttr(sphere + '.t', translate[0], translate[1], translate[2])
            blinn = mc.shadingNode('blinn', n='%s_blinn' % attr, asShader=True)
            mc.select(sphere)
            mc.sets(renderable=True, noSurfaceShader=True, empty=True, n='%s_SG' % blinn)
            mc.connectAttr('%s.outColor' % blinn, '%s_SG.surfaceShader' % blinn)
            mc.sets(edit=True, forceElement='%s_SG' % blinn)
            mc.connectAttr(self.prefix + '_solidDrive_settings.%s' % attr, '%s.colorR' % blinn)
            mc.connectAttr(self.prefix + '_solidDrive_settings.%s' % attr, '%s.colorG' % blinn)
            mc.connectAttr(self.prefix + '_solidDrive_settings.%s' % attr, '%s.colorB' % blinn)
        
        return


if __name__ == '__main__':
    SoliDrive_class('test').createTestExample()
    pass